package com.log;

import java.io.File;
import java.io.IOException;

import org.apache.commons.io.FileUtils;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Service;

import com.google.common.collect.Lists;

@Service
@ConfigurationProperties
public class LogFileService {
	 private String logUrl;

	public String getLogUrl() {
		return logUrl;
	}

	public void setLogUrl(String logUrl) {
		this.logUrl = logUrl;
	}

	public void write(String log)  {
		File file = new File(logUrl);
		try {
			FileUtils.writeLines(file, Lists.newArrayList(log), true);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
	}
}
